package com.peng.cms.controller;


import com.peng.cms.entity.CrmBanner;
import com.peng.cms.entity.vo.BannerQuery;
import com.peng.cms.service.CrmBannerService;
import com.peng.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author Dengp
 * @since 2022-06-18
 */
@RestController
@RequestMapping("/cms/banner")
@CrossOrigin
public class CrmBannerFrontController {
    @Autowired
    private CrmBannerService crmBannerService;

    //查询所有幻灯片
    @GetMapping("getAll")
    @Cacheable(value = "banner",key = "'getAll'")
    public Result getAll(){
        List<CrmBanner> list = crmBannerService.getAll();
        HashMap<String, Object> map = new HashMap<>();
        map.put("list",list);
        return Result.ok().data(map);
    }
}

